﻿@{
    Layout = null;
}

@model ElingOA6_Admin_DSJCJ.Model.AlbumEntry
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
<link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
@Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
@Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)


<script type="text/javascript">
    function Save() {
        lpModal.Show();
        var bl = true;
        var note = FAlbumNote.GetText();
        if (note == null || ASPxClientUtils.Trim(note) == "") {
            FAlbumNote.SetErrorText("请填写简介");
            FAlbumNote.SetIsValid(false);
            bl = false;
        }


        var seq = FDispSeq.GetText();
        if (seq == null || ASPxClientUtils.Trim(seq) == "") {
            FDispSeq.SetErrorText("请填写显示顺序");
            FDispSeq.SetIsValid(false);
            bl = false;
        } else {
            if (!isNumeric(seq)) {
                FDispSeq.SetErrorText("显示顺序必须是整数!");
                FDispSeq.SetIsValid(false);
                bl = false;
            }
        }


        if (bl) {
            var img = FAlbumPhoto.GetText();
            img = img.substring(img.lastIndexOf("."));
            img = img.toLowerCase();
            if (img != "" && img != ".jpg" && img != ".jpeg" && img != ".gif") {
                alert("请上传以下类型封面图片  .jpg .jpeg .gif");
                bl = false;
            }
        }

        if (bl) {
            form1.submit();
        } else {
            lpModal.Hide();
        }


    }

</script>

</head>
<body>
@using (Html.BeginForm("PicEditSave", "Album", FormMethod.Post, new { id = "form1" }))
{
    <table class="tableFrom">        
           <tr>
            <th>图片简介:</th>
            <td>
               @Html.DevExpress().Memo(settings =>
              {
                  settings.Name = "FAlbumNote";
                  settings.Width = 360;
                  settings.Properties.Rows = 3;
                  settings.Text = Model.FAlbumNote;
                  settings.Properties.ValidationSettings.EnableCustomValidation = true;
              }).GetHtml()              
           </td>
           </tr>           
           <tr>
           <th>显示顺序:</th>
           <td>
               @Html.DevExpress().TextBox(settings =>
              {
                  settings.Name = "FDispSeq";
                  settings.Width = 100;
                  settings.Text = Model.FDispSeq.ToString();
                  settings.Properties.ValidationSettings.EnableCustomValidation = true;
              }).GetHtml()
           </td>
           </tr>           
          <tr>
           <th>图片:</th>
           <td>
               @Html.DevExpress().UploadControl(
            settings =>
            {
                settings.Name = "FAlbumPhoto";
                settings.BrowseButton.Text = "浏览";
                settings.ClearFileSelectionImage.ToolTip = "清除选择";
                settings.ShowProgressPanel = true;                
                settings.ShowUploadButton = false;
            }).GetHtml()
           </td>
           </tr>
           <tr>
            <td></td>
            <td>
                <img alt="" width="100px" height="60px" id="previewImage" src="@Url.Content(Model.FAlbumThumbURL)" />
            </td>
           </tr>
        @*<tr>
            <td>
                 @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnOk";
                settings.Text = "确定";
                settings.ControlStyle.CssClass = "right";
                settings.ClientSideEvents.Click = "Save";
            }).GetHtml()
            </td>
            <td>
                @Html.DevExpress().Button(settings =>
           {
               settings.Name = "btnCancel";
               settings.Text = "取消";
               settings.ControlStyle.CssClass = "left";
               settings.ClientSideEvents.Click = "function(){parent.picEditModalModeCancel();}";
           }).GetHtml()	
            </td>
        </tr>*@
      </table>
    

    @Html.Hidden("FAlbumEntryID", Model.FAlbumEntryID)
                                  
    
}

<script>
    lp.Hide();
</script>
</body>
</html>